<template>
  <div class="chart-container">
    <el-row>
      <!-- <chart height="100%" width="100%"/> -->
    </el-row>
    <el-row>
      <el-table :data="tableData.slice((pno-1)*pageSize,pno*pageSize)" style="width: 100%">
        <el-table-column prop="date" label="日期" width="150"></el-table-column>

        <el-table-column label="预览数">
          <el-table-column prop="province" label="PV" width="120"></el-table-column>
          <el-table-column prop="city" label="UV" width="120"></el-table-column>
        </el-table-column>
        <el-table-column label="下载数">
          <el-table-column prop="province" label="PV" width="120"></el-table-column>
          <el-table-column prop="city" label="UV" width="120"></el-table-column>
        </el-table-column>
        <el-table-column label="收藏数">
          <el-table-column prop="province" label="PV" width="120"></el-table-column>
          <el-table-column prop="city" label="UV" width="120"></el-table-column>
        </el-table-column>
        <el-table-column label="转化率">
          <el-table-column prop="province" label="PV" width="120"></el-table-column>
          <el-table-column prop="city" label="UV" width="120"></el-table-column>
        </el-table-column>
      </el-table>

      <!-- 分页器 -->
      <div class="block" style="margin-top:15px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5,10,15,20,25,30]"
          :page-size="pageSize"
          :pager-count="7"
          layout="sizes, prev, pager, next,jumper, ->,total"
          :total="total"
        ></el-pagination>
      </div>
    </el-row>
  </div>
</template>

<script>
// import Chart from "@/components/Charts/MixChart";

export default {
  name: "MixChart",
  data() {
    return {
        tatal:100,
      // 分页
      pno: 1, //默认第一页
      pageSize: 15, //每页大小默认值

      tableData: [
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-02",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-08",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-06",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        },
        {
          date: "2016-05-07",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
          zip: 200333
        }
      ]
    };
  },
  components:{
    // Chart
  },

  computed:{
    total(){
        return this.tableData.length;
    }
  },
  //   components: { Chart },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSizeChange(val) {
      this.pageSize = val;
    },

    handleCurrentChange(val) {
      this.pno = val;
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  }
};
</script>

<style scoped>
.chart-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 84px);
}
</style>